use idgenerator::{IdGeneratorOptions, IdInstance};

/// 初始化 id 生成器
pub fn setup_id_generator() {
    let options = IdGeneratorOptions::new().worker_id(1).worker_id_bit_len(6);
    // Initialize the id generator instance with the option.
    // Other options not set will be given the default value.
    let _ = IdInstance::init(options).ok().expect("id生成失败，请重试");
}

/// 生成 id
pub fn next_id() -> i64 {
    return IdInstance::next_id();
}
